package com.hsnn.medstgmini.base.dict.model;

import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

/**
 * 规格字典 维护记录model
 * @author hss@njhsnn
 * 2015年6月9日
 */
@Entity
@Table(name = "dic_drugspec_log")
public class DicDrugspecLog implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -6854411293823449469L;
	private String logId;//日志id
	private String specId;//规格id
	private String specCode;//规格编码
	private String specName;//规格
	private String fatherId;//父级id
	private Short status;//状态
	private Date updDatetime;//更新时间
	private String updUser;//更新人
	private Short sortId;//排序id
	
	private String detail;
	

	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}


	private DicDrugspec dicDrugspecCode;//规格维护日志对象
	
	private long count;
	// Constructors

	/** default constructor */
	public DicDrugspecLog() {
	}

	/** minimal constructor */
	public DicDrugspecLog(String specId, String specCode, String specName) {
		this.specId = specId;
		this.specCode = specCode;
		this.specName = specName;
	}

	/** full constructor */
	public DicDrugspecLog(String specId, String specCode, String specName,
			String fatherId, Short status, Timestamp updDatetime,
			String updUser, Short sortId) {
		this.specId = specId;
		this.specCode = specCode;
		this.specName = specName;
		this.fatherId = fatherId;
		this.status = status;
		this.updDatetime = updDatetime;
		this.updUser = updUser;
		this.sortId = sortId;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "log_id", unique = true, nullable = false, length = 36)
	public String getLogId() {
		return this.logId;
	}

	public void setLogId(String logId) {
		this.logId = logId;
	}

	@Column(name = "spec_id", nullable = false, length = 36)
	public String getSpecId() {
		return this.specId;
	}

	public void setSpecId(String specId) {
		this.specId = specId;
	}

	@Column(name = "spec_code", nullable = false, length = 10)
	public String getSpecCode() {
		return this.specCode;
	}

	public void setSpecCode(String specCode) {
		this.specCode = specCode;
	}

	@Column(name = "spec_name", nullable = false, length = 100)
	public String getSpecName() {
		return this.specName;
	}

	public void setSpecName(String specName) {
		this.specName = specName;
	}

	@Column(name = "father_id",insertable=false,updatable=false, length = 36)
	public String getFatherId() {
		return this.fatherId;
	}

	public void setFatherId(String fatherId) {
		this.fatherId = fatherId;
	}

	@Column(name = "status")
	public Short getStatus() {
		return this.status;
	}

	public void setStatus(Short status) {
		this.status = status;
	}

	@Column(name = "upd_datetime", length = 19)
	public Date getUpdDatetime() {
		return this.updDatetime;
	}

	public void setUpdDatetime(Date date) {
		this.updDatetime = date;
	}

	@Column(name = "upd_user", length = 36)
	public String getUpdUser() {
		return this.updUser;
	}

	public void setUpdUser(String updUser) {
		this.updUser = updUser;
	}

	@Column(name = "sort_id")
	public Short getSortId() {
		return this.sortId;
	}

	public void setSortId(Short sortId) {
		this.sortId = sortId;
	}


	@ManyToOne(cascade=CascadeType.REFRESH,fetch=FetchType.EAGER)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="father_id")
	public DicDrugspec getDicDrugspecCode() {
		return dicDrugspecCode;
	}

	public void setDicDrugspecCode(DicDrugspec dicDrugspecCode) {
		this.dicDrugspecCode = dicDrugspecCode;
	}

	 @Transient
	    public long getCount() {
			return count;
		}


		public void setCount(long count) {
			this.count = count;
		}

}